package com.code.apollo.pojo;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

/**
 * <Description>
 * 配置
 * @author Jun Lee
 * @version 1.0
 * @createDate 2020/03/16 11:30
 * @see com.code.apollo.pojo
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class Configs {
    private String project="example";
    private String packagePath="com.example.demo";
    private String projectComment;
    private String author;
    private String path1="com";
    private String path2="example";
    private String path3="demo";
    private String pathAll;
    private String[] pathArr;

    public Configs(String project, String pPackage, String projectComment, String author) {
        if(StringUtils.isNotBlank(project)) {
            this.project = project;
        }
        if(StringUtils.isNotBlank(pPackage)) {
            this.packagePath = pPackage;
        }
        this.projectComment = projectComment;
        this.author = author;
        pathArr = pPackage.split("\\.");
        if (pathArr.length <= 0 || (pathArr.length == 1 || pathArr[0].equals("")) ) {
            pathArr = new String[]{path1,path2,path3};
        }
        pathAll = pPackage.replaceAll(".","/");
    }
}
